function mxCellOverlay(image, tooltip, align, verticalAlign)
{
	this.image = image;
	this.tooltip = tooltip;
	this.align = align;
	this.verticalAlign = verticalAlign;
};
mxCellOverlay.prototype = new mxEventSource();
mxCellOverlay.prototype.constructor = mxCellOverlay;
mxCellOverlay.prototype.image = null;
mxCellOverlay.prototype.tooltip = null;
mxCellOverlay.prototype.align = null;
mxCellOverlay.prototype.verticalAlign = null;
mxCellOverlay.prototype.defaultOverlap = 0.5;
mxCellOverlay.prototype.getBounds = function(state)
{
	var isEdge = state.view.graph.getModel().isEdge(state.cell);
	var s = state.view.scale;
	var pt = null;
	var w = this.image.width;
	var h = this.image.height;

	if (isEdge)
	{
		var pts = state.absolutePoints;

		if (pts.length % 2 == 1)
		{
			pt = pts[pts.length / 2 + 1];
		}
		else
		{
			var idx = pts.length / 2;
			var p0 = pts[idx - 1];
			var p1 = pts[idx];
			pt = new mxPoint(p0.x + (p1.x - p0.x) / 2, p0.y + (p1.y - p0.y) / 2);
		}
	}
	else
	{
		pt = new mxPoint();

		if (this.align == mxConstants.ALIGN_LEFT)
		{
			pt.x = state.x;
		}
		else if (this.align == mxConstants.ALIGN_CENTER)
		{
			pt.x = state.x + state.width / 2;
		}
		else
		{
			pt.x = state.x + state.width;
		}

		if (this.verticalAlign == mxConstants.ALIGN_TOP)
		{
			pt.y = state.y;
		}
		else if (this.verticalAlign == mxConstants.ALIGN_MIDDLE)
		{
			pt.y = state.y + state.height / 2;
		}
		else
		{
			pt.y = state.y + state.height;
		}
	}
	return new mxRectangle(pt.x - w * this.defaultOverlap * s, pt.y - h * this.defaultOverlap * s, w * s, h * s);
};
mxCellOverlay.prototype.toString = function()
{
	return this.tooltip;
};